<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>三鑫灯世界 - 登录</title>
<link href="__PUBLIC__/css/style_log.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/style.css">
    <script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>


</head>

<body class="login" mycollectionplug="bind">
	<div style="padding:30px 0 0 40px">
		<a href="index.html" >返回商城首页>></a>
	</div>	
<div class="login_m">
<div class="login_boder">

<div class="login_padding" id="login_model">

  <h2>手机号</h2>
  <label>
    <input type="text" id="phone" class="txt_input txt_input2" placeholder="手机号">
  </label>
  <h2>密码</h2>
  <label>
    <input type="password" name="textfield2" id="password" class="txt_input" value="">
  </label>
 
<!-- 验证码start-->
	<div>
	  <div class="rem_sub">
	      <input type="text" class="txt_input" name="button" id="verifys" placeholder="请输入验证码" style="opacity: 0.7;float: left;width: 50%;">
	  </div>
	  <div class="rem_sub">  
	      <img src="{:U('verify')}" alt="" style="height: 36px;float: right;" id="verify"/>
	  </div>
	</div>
    <p style="color: red;display: none;margin-top: -15px;clear:both;" id="yzm">验证码错误</p>
<!-- 验证码end-->
  <div class="forgot" style="line-height: 26px;clear:both">
  	<div class="rem_sub_l" style="display: inline-block;">
		</div>
  	<a id="iforget" href="zhaohui.html" style="float: right;">忘记密码？</a>
  </div>
  <div class="rem_sub">
  	<label>
      <input type="submit" class="sub_button" name="button" onclick="login('user')" id="login" value="登  录" style="opacity: 0.7;float: left;">
    </label>
  </div>
  <div class="rem_sub">  
    <label>
      <input type="submit" class="sub_button" name="button" onclick="window.location.href='zhuce.html'" value="注  册" style="opacity: 0.7;">
    </label>
  </div>
</div>
    <script>
        var verify =document.getElementById('verify');
         verify.onclick=function () {
             this.src=this.src+'?'+Math.random();
         }

        function login(type) {
           var type = type;
            var phone = $('#phone').val();
            var password = $('#password').val();
            var verifys = $('#verifys').val();
            $.ajax({
                url:"{:U('logining')}",
                data:{'usertype':type,'phone':phone,'password':password,'verify':verifys},
                type:'post',
                success:function (e) {
                    if(e == 1){
                        window.location.href="{:U('index')}";
                    }else if(e == -1){
                        $('#yzm').css('display','block');
                        verify.click()
                    }else if(e == 3){
                        alert('该用户被禁用，请联系网站管理员');
                    }else{
                        alert('用户名或密码错误');
                    }
                }
            })
        }

        function asd() {
            alert(123)
        }

        //登录键盘事件
        $(function() {
            $(document).keydown(function (event) {
                if (event.keyCode == 13) {
                    login('user');
                }
            });
        })
    </script>

<!--login_padding  Sign up end-->
</div><!--login_boder end-->
</div><!--login_m end-->
 <br> <br>

</body></html>
